/**
 * This class is the view model for the Main view of the application.
 */
Ext.define('extjs6test.view.main.MainModel', {
    extend: 'Ext.app.ViewModel',
    alias: 'viewmodel.main',
    data: {
        logoName: 'Extjs6 Demo',
        loremIpsum: '1',
        logoWidth: 250,
        logoHeight: 70,
        treelistContainerCls: "",
        errorMsg: {
            emptyText: ' isn\'t allow empty'
        },
        departmentManagerTitle: 'Department Manager',
        departmentManagerQueryBar: {
            deptCodeLabel: 'DepartCode:',
            deptNameLabel: 'DepartName:'
        },
        jurisdictionManager: {
            title: 'Jurisdiction Manager',
            tree: {
                width: 200
            }
        },
        jurisdictionEditWindow: {
            jurisdictionIdTF: {
                text: 'Jurisdiction Id'
            },
            juriCodeTF: {
                text: 'Jurisdiction Code'
            },
            juriNameTF: {
                text: 'Jurisdiction Name'
            },
            juriLevelTF: {
                text: 'Jurisdiction Level'
            },
            parentIdTF: {
                text: 'Parent Jurisdiction Id'
            },
            leafTF: {
                text: 'Leaf'
            },
            juriFullCodeTF: {
                text: 'Jurisdiction Full Code'
            },
            parentNameTF: {
                text: 'Parent Jurisdiciton Name'
            }
        },
        baseToolbar: {
            baseQueryButton: "Search",
            baseAddButton: "",
            baseModifyButton: "",
            baseRemoveButton: "",
            baseExportExcelButton: "Export Excel",
            baseExportPDFButton: "Export PDF",
            baseExportSplitButton: {
                menu: {
                    items: [
                        {text: 'Export Excel', glyph: 'xf1c3@FontAwesome', handler: 'onBaseExportExcel'},
                        {text: 'Export PDF', glyph: 'xf1c1@FontAwesome', handler: 'onBaseExportPDF'}
                    ]
                }
            },
            baseImportExcelButton: 'Import Excel',
            baseImportSplitButton: {
                menu: {
                    items: [
                        {text: 'Import Excel', iconCls: 'x-fa fa-file-excel-o', handlder: 'onBaseImportExcel'}
                    ]
                }
            }
        },
        baseEditWindow: {
            title: 'Base Edit Window',
            OkButton: {
                text: 'Ok'
            },
            closeButton: {
                text: 'Close'
            }
        },
        dictManager:{
            title:'Dict Manager',
            queryBar:{
                dictCodeLabel:'Dict Code',
                dictNameLabel:'Dict Name'
            }
        }
    },
    formulas: {
        selectionText: function (get) {
            var selection = get('treelist.selection'), path;
            if (selection) {
                path = selection.getPath('text');
                path = path.replace(/^\/Root/, '');
                return 'Selected: ' + path;
            }
            else {
                return 'No node selected';
            }
        }
    }
});
